import cv2
import numpy as np

def encode(img,img_key):
    result=img=cv2.bitwise_xor(img,img_key)
    return result

flower=cv2.imread(r'CV-Pictures/036.jpg')
h,w,c=flower.shape

img_key=np.random.randint(0,256,(h,w,c),np.uint8)
cv2.imshow('flower',flower)
# cv2.imshow('img_key',img_key)

result1=encode(flower,img_key)
result2=encode(result1,img_key)
# cv2.imshow('result1',result1)
cv2.imshow('result2',result2)
cv2.waitKey(0)
cv2.destroyAllWindows()